package ma.model.auxillary;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ParameterList {
	private Map<ParameterType, ArrayList<ParameterCollection>> parameterList;	
	
	public enum ParameterType {
        MATERIAL_PARAMETER,
        PROCESS_PARAMETER,
        GEOMETRY_PARAMETER,        
        TOOL_PARAMETER,
        DEPENDENT_PARAMETER
    }
	
	public ParameterList() {				
		parameterList = new HashMap<ParameterType, ArrayList<ParameterCollection>>();
	}
	
	public void addParameterCollection(ParameterType parameterType,
			ParameterCollection parameterCollection) {
		if (parameterCollection != null) {
			parameterList.get(parameterType).add(parameterCollection);	
		}		
	}
	
	public ArrayList<ParameterCollection> getParameterCollection
		(ParameterType parameterType) { 
		return parameterList.get(parameterType);		
	}
	
	public ParameterCollection getParameterCollection (
			int index, ParameterType parameterType) {
		List<ParameterCollection> collection =
				parameterList.get(parameterType);
		if (index < collection.size() - 1 && index >= 0) {
			return collection.get(index);
		}
		throw new IndexOutOfBoundsException(index + " given. Size of parameter "
				+ "list: " + parameterList.size());
	}
	
	public void setParameterValue(
			ParameterType parameterType,
			int index,
			String parameterAbbreviation,
			Double value) {
		
		getParameterCollection(index, parameterType).
			setParameter(parameterAbbreviation, value);
	}
	
	public ParameterCollection getParameter(ParameterType parameterType, 
			String parameterAbbreviation) {
		for (int i = 0; i < parameterList.get(parameterType).size(); i++) {
			
		}
	}
	
}
